package localdb.dao
{
	import model.PageUpdate;
	
	import asorm.db.DAO;
	import asorm.db.LocalDatabaseTable;

	[Bindable]
	public class PageUpdateDAO extends DAO implements PageUpdate
	{
		public function PageUpdateDAO(table: LocalDatabaseTable, pageId: String = null) {
			super(table);
			primaryKeyField = "updateId";
			_updateId = -1;
			_pageId = pageId;
			_diffText = "";
			_modificationDate = new Date();
		}
				
		public function get updateId(): int {
			return _updateId;
		}
		
		public function set updateId(value:int): void {
			_updateId = value;
		}

		public function get pageId(): String {
			return _pageId;
		}

		public function set pageId(value:String): void {
			_pageId = value;
		}

		public function get diffText(): String {
			return _diffText;
		}

		public function set diffText(value:String): void {
			_diffText = value;
		}

		public function set modificationDate(value: Date): void {
			if (_modificationDate != value) {
				_modificationDate = value;
			}
		}
		
		public function get modificationDate(): Date {
			return _modificationDate;
		}

		public function isNew(): Boolean {
			return _pageId == null;
		}

		private var _updateId: int;
		private var _pageId: String;
		private var _diffText: String;
		private var _modificationDate:Date;
			
	}
}